package com.bridge.client.bridgedynamcclient.custom_compinents;

import com.bridge.client.bridgedynamcclient.bean.vo.resp.BridgeSampleData;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.HBox;

public class SampleSelectItem extends HBox {



    public SampleSelectItem(BridgeSampleData.BridgeSample bridgeSample, boolean select){
        CheckBox checkBox=new CheckBox(bridgeSample.getFileName());
        checkBox.setSelected(select);
        checkBox.setOnAction(a->{
            System.out.println("SampleSelectItem a = " + a);
        });
        checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() {
            @Override
            public void changed(ObservableValue<? extends Boolean> observableValue, Boolean olaValue, Boolean newValue) {
                bridgeSample.setSelect(newValue);
            }
        });
        bridgeSample.setSelect(select);
        getChildren().add(checkBox);
    }
}
